﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Gnosis.Alexandria.Data;
using Gnosis.Alexandria.Views;

namespace Gnosis.Alexandria.Controllers
{
    public class MainTabController
        : ControllerOldBase
    {
        public MainTabController(MainController parent)
            : base(parent)
        {
        }

        private MainTabView _view;

        protected override void HandleMessage(IMessageOld message)
        {
            switch (message.Type)
            {
                case MessageTypes.RequestControllerInitialize:
                    _view = new MainTabView();
                    _view.Controller = this;
                    SendParent(CreateMessage(MessageTypes.RequestMainTabViewLoad, _view));
                    _view.Send(CreateMessage(MessageTypes.RequestMainTabViewNewTab));
                    break;
                case MessageTypes.RequestArtistEditLoad:
                {
                    var data = message.Body as EditRequestData;
                    SendParent(CreateMessage(MessageTypes.RequestRepositoryGetArtist, new ArtistEditData { Id = data.Id }));
                    break;
                }
                default:
                    _view.Send(message);
                    break;
            }
        }
    }
}
